package com.itheima.service.impl;

import com.itheima.mapper.UserMapper;
import com.itheima.pojo.dto.IntegralDTO;
import com.itheima.pojo.dto.LoginDTO;
import com.itheima.pojo.Student;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserByMobile(String mobile) {
        return userMapper.findUserByMobile(mobile);
    }

    @Override
    public User login(LoginDTO loginDTO) {
        return userMapper.login(loginDTO);
    }

    @Override
    public List<Student> findAll() {
        return userMapper.findAll();
    }

    @Override
    public boolean addIntegral(IntegralDTO integralDTO) {
        return userMapper.addIntegral(integralDTO) > 0;
    }

    @Override
    public boolean updateGroupsIntegralByClassId(Integer classId) {
        return userMapper.updateGroupsIntegralByClassId(classId) > 0;
    }
}
